﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SSharp.Core.DataTypes {
	/// <summary>
	/// Represents a primitive procedure; has a name and a
	/// </summary>
	public sealed class PrimitiveProcedure : Procedure {
		/// <summary>
		/// The Func that applies the procedure.
		/// Accepts an array of the parameters, returns the result.
		/// </summary>
		public readonly Func<object[], object> Procedure;

		public PrimitiveProcedure(string name, Func<object[], object> procedure)
			: base(name) {
			Procedure = procedure;
		}

		public override string ToString() {
			return "#<procedure:" + Name + ">";
		}
		
		public override Procedure Rename(string name) {
			return new PrimitiveProcedure(name, Procedure);
		}
	}
}
